# -*- coding: utf-8 -*-
"""
Created on Thu Apr 21 19:03:34 2022

@author: Jovi Wong
"""

from StackedAutoEncoder import StackedAutoEncoder
from SAETrainer import SAETrainer
from Augmentor import Augmentor
from Evaluator import Evaluator

if __name__ == "__main__":
    original_data_path = "dataset/epinions.mat"
    eta_sae = StackedAutoEncoder(7000, 1024, 128, 32, name="ETA_epinions")
    eta_sae_trainer = SAETrainer(eta_sae, original_data_path)
    feat_path = eta_sae_trainer.train(1, mode="train")
    eta_augmentor = Augmentor(original_data_path, feat_path)
    graph_path = eta_augmentor.train(1)
    evaluator = Evaluator(graph_path)
    print("<<<<<<<<<< Final Results of the ETA model >>>>>>>>>>>")
    auc, ap = evaluator.link_predict()
    print("link prediction performance: AUC={0}, AP={1}".format(auc, ap))
    err_rate =  evaluator.node_cluster()
    print("node clustering performance: error rate = {0}".format(err_rate))